import { Catch, MidwayHttpError } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';

export class MissTargetError extends MidwayHttpError {
  constructor(message: string) {
    super(message, 777);
  }
}
@Catch(MissTargetError)
export class MissTargetErrorFilter {
  async catch(err: MissTargetError, ctx: Context) {
    ctx.status = err.status;
    return {
      message: err.message,
    };
  }
}
